<?php

class StatusParticipation
{
	protected $_id;
	protected $_name;
	
	public function __construct(array $donnees)
	{
		$this->hydrate($donnees);
	}
	
	public function hydrate(array $donnees)
	{
		foreach($donnees as $key => $value)
		{
			$method = 'set'. ucfirst($key);
			if(method_exists($this, $method))
			{
				$this->$method($value);
			}
		}
	}
	
	public function id(){ return $this->_id; }
	public function name(){ return $this->_name; }
	
	public function setId($id)
	{
		$id = (int) $id;
		if(is_int($id))
		{
			$this->_id = $id;
		}
	}
	public function setName($name)
	{
		$name = (string) $name;
		if(is_string($name))
		{
			$this->_name = $name;
		}
	}
	
}